/*
let x = 1;
let y = 34;
// let temp = x
// x = y
// y = temp
[y, x] = [x, y]
console.log(x) // 34
console.log(y) // 1
*/


// function myAjax(options) {
function myAjax({ url, method = "GET", data = null, success = function() {} }) {
	// const method = options.method
	// const { method = "GET", url, data, success } = options
	console.log(method)
	console.log(url)
	console.log(data)
	console.log(success)
	/*const xhr = new XMLHttpRequest()
	xhr.open(method, url)
	xhr.send(data)
	xhr.onreadystatechange = function() {
		if(xhr.readyState === 4) {
			if(xhr.status === 200) {
				// success
				success(xhr.response)
			} else {
				// error
				error(xhr.statusText)
			}
		}
	}*/
}
/*
myAjax({
	url: "https://www.abc.com/path",
})

myAjax({
	// method: "POST",
	url: "https://www.abc.com/path",
	data: {
		name: 123
	},
	success(res) {
		console.log(res)
	},
	error(e) {
		console.log(e)
	}
})*/


































